/*
 * @Author: xiaorao 2930367909@qq.com
 * @Date: 2025-02-21 10:47:03
 * @LastEditors: xiaorao 2930367909@qq.com
 * @LastEditTime: 2025-02-21 10:48:09
 * @FilePath: \common\CommonVue\vite.config.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { fileURLToPath, URL } from "node:url";

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";
import tailwindcss from "tailwindcss";
import autoprefixer from "autoprefixer";
import vueJsx from "@vitejs/plugin-vue-jsx";
import vueDevTools from "vite-plugin-vue-devtools";

// https://vite.dev/config/
export default defineConfig({
  server: {
    host: "0.0.0.0", // 这个用于启动
    port: 9001, // 指定启动端口
    hmr: true, // 热更新
  },
  css: {
    postcss: {
      plugins: [tailwindcss, autoprefixer],
    },
  },
  plugins: [vue(), vueJsx(), vueDevTools()],
  base: "./",
  resolve: {
    alias: {
      "@": resolve(__dirname, "src"),
      components: resolve(__dirname, "src/components"),
      component: resolve(__dirname, "src/component"),
      api: resolve(__dirname, "src/api"),
      views: resolve(__dirname, "src/views"),
      store: resolve(__dirname, "src/store"),
      utils: resolve(__dirname, "src/utils"),
      plugins: resolve(__dirname, "src/plugins"),
      assets: resolve(__dirname, "src/assets"),
      stores: resolve(__dirname, "src/stores"),
      style: resolve(__dirname, "src/style"),
      router: resolve(__dirname, "src/router"),
    },
    extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue"],
  },
});
